﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace enumpractice
{
    /// <summary>
    /// 性别
    /// </summary>
    public enum SexTypes
    {
        woman,
        man
    }
    /// <summary>
    /// 姓氏
    /// </summary>
    public enum Surnames
    {
        Zhao,
        Li,
        Wang,
        Qian,
        Ma,
        Liu,
        HU,
        Fan,
        Chan,
        Zhang,
        Yao,
        Shen,
        Si,
        Long,
        Yan,
        Du,
        An,
        Tian,
        Cheng,
        Chai,
        Chen,
        Duan,
        Gao,
        Jian,
        Jia,
        Jin,
        Luo,
        Miao,
        Peng,
        Qiao,
        Qi,
        Song,
        Shi,
        Wen,
        Xing,
        Xv,
        Xve,
        Yang,
        Zou,
        Wu,
        Zhou,
        Kou,

    }
    /// <summary>
    /// 地区
    /// </summary>
    public enum Areas
    {
        ChangAn,
        YouZhou,
        XianYang,
        LouLan,
        GuSu,
        LanLing,
        JinLing,
        LangYa,
        GuangLing,
        JingLing,
        XunYang,
        LuZhou,
 
    }
    class Person
    {
        //人的属性
        public SexTypes Sex;//性别
        public Surnames surname;//姓氏
        public string foreName;//名
        public string styleName;//字
        public Areas nativePlace;//籍贯
        public int age;//年龄
        bool sayAge = false;
        bool havehome = false;
        public void SetPerson(  Surnames f, string n,string s,SexTypes sex,int? a = null ,Areas? p  = null)
        {

            Sex = sex;//性别
            surname = f;//姓
            foreName = n;//名
            styleName = s;//字
            if(a != null)
            {
               age = (int)a;
                sayAge = true;
            }
            if (p != null)
            {
                nativePlace = (Areas)p;
                havehome = true;
            }
  
        }
        public void SelfIntroduction()
        {
            Console.WriteLine();
            Console.Write($"大家好,在下姓{surname}名{foreName}字{styleName}.");
            if(havehome)
            {
                Console.Write($"家住在{nativePlace}，");
            }
            if(sayAge)
            {
                Console.Write($"今年{age}岁。");
            }
        }
    }
    internal class Program
    {
        static void Main(string[] args)
        {
            Person shenSuAn = new Person();
            shenSuAn.SetPerson(Surnames.Shen,"tian","Su'an",SexTypes.man,19);
            shenSuAn.SelfIntroduction();
            Console.WriteLine();
        }

    }
}
